import QsRequest from '@/service';
import { LoginRequest, UserInfoResponse } from './model/type';

/**
 * @description: 登录
 * @param {UserInfoRequest} data
 * @return {*}
 */
export const login = (data: LoginRequest) => {
    return QsRequest.post<UserInfoResponse>(`/login`, data, {
        params: {
            grant_type: 'username_password'
        },
        headers: { hideLoading: 1, hideMsg: 1 }
    });
};

/**
 * @description: 退出登录
 * @return {*}
 */
export const logout = (token: string) => {
    return QsRequest.post(`/logout`, null, {
        headers: { hideLoading: 1, Authorization: token }
    });
};
